import request from '@/utils/axios'

export type MailAccountType = {
  id: number
  mail: string
  username: string
  password: string
  host: string
  port: number
  sslEnable: boolean
}

export interface MailAccountPageReqType extends PageParam {
  username?: string
  mail?: string
}

/**
 * 消息中心 - 邮箱管理 - 邮箱账号接口
 */
export const MailAccountApi = {
  // 新增
  create: (data: MailAccountType) => {
    return request.post({ url: '/system/mail-account/create', data, is_mock: true })
  },
  // 修改
  update: (data: MailAccountType) => {
    return request.put({ url: '/system/mail-account/update', data, is_mock: true })
  },
  // 删除
  delete: (id: number) => {
    return request.delete({ url: '/system/mail-account/delete?id=' + id, is_mock: true })
  },
  // 查询详情
  detail: (id: number) => {
    return request.get({ url: '/system/mail-account/detail?id=' + id, is_mock: true })
  },
  // 查询分页列表
  page: (params: MailAccountPageReqType) => {
    return request.get({ url: '/system/mail-account/page', params, is_mock: true })
  },
  // 查询精简列表
  simple: () => {
    return request.get({ url: '/system/mail-account/simple-list', is_mock: true })
  }
}
